<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \backend\models\LoginForm */

$this->title = '登录';

$fieldOptions1 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-user form-control-feedback'></span>"
];

$fieldOptions2 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-lock form-control-feedback'></span>"
];
?>
<div class="login-box">
    <div class="login-box-body">
        <p class="login-box-msg" style="font-size: 18px;"><?=app()->id;?></p>
        <?= \dmstr\widgets\Alert::widget() ?>
        <?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => true]); ?>

        <?= $form->field($model, 'username', $fieldOptions1)->label(false)->textInput(['placeholder' => '请输入登录账号','class'=>'form-control input-lg','autofocus' => true]) ?>

        <?= $form->field($model, 'password', $fieldOptions2)->label(false)->passwordInput(['placeholder' => '请输入登录密码','class'=>'form-control input-lg']) ?>

        <?= $form->field($model,'captcha')->widget(\yii\captcha\Captcha::className(),[
            'captchaAction'=>'site/captcha',
            'template' => '{image} <div class="has-feedback">{input} <span class="glyphicon glyphicon-flag form-control-feedback"></span></div>',
            'imageOptions'=>[
                'alt'=>'点击换图',
                'title'=>'点击换图',
                'style'=>'cursor:pointer'
            ],
            'options'=>[
                'placeholder' => '请输入验证码',
                'class' => 'form-control input-lg'
            ]
        ]);?>

        <div class="row">
            <div class="col-md-4">
                <?= $form->field($model, 'rememberMe')->checkbox()->label('记住密码') ?>
            </div>
            <div class="col-md-8 hide">
                <div class="form-group field-loginform-agree">
                    <div class="checkbox">
                        <label for="loginform-agree">
                            <input type="checkbox" id="agree" name="LoginForm[agree]" value="1" checked="checked">
                            同意并遵守 《服务条款》
                        </label>
                    </div>
                </div>
            </div>
        </div>
        <div class="row text-center">
            <div class="col-md-12">
                <?= Html::submitButton('登陆', ['class' => 'btn btn-primary btn-block btn-flat btn-lg', 'name' => 'login-button']) ?>
            </div>
            <div class="col-md-6 hide">
                <?= Html::a('免费注册', '',['class' => 'btn btn-link', 'name' => 'login-button']) ?>
            </div>
            <div class="col-md-6 hide">
                <?= Html::a('忘记密码？', '',['class' => 'btn btn-link', 'name' => 'login-button']) ?>
            </div>
        </div>

        <?php ActiveForm::end(); ?>

    </div>

</div>